﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Js_Study.HTMLComponents
{
    public partial class SelectAjax : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string tag = Request["tag"] ?? string.Empty;

            if (tag == "sel1")
            {
                Response.Write("[{id:'1',text:'中国'},{id:'2',text:'美国'},{id:'3',text:'德国'}]");
            }
            if (tag == "sel2")
            {
                Response.Write("[{id:11,text:'中国1'},{id:22,text:'美国2'},{id:33,text:'德国3'}]");
            }
            if (tag == "sel3")
            {
                Response.Write("[{id:111,text:'中国11'},{id:222,text:'美国22'},{id:333,text:'德国33'}]");
            }
            if (tag == "fromSel1")
            {
                Response.Write("[{id:10,text:'中国xx'},{id:12,text:'美国xx'},{id:13,text:'德国xx'}]");
            }
            if (tag == "fromSel2")
            {
                Response.Write("[{id:11,text:'中国wwxx'},{id:12,text:'美国wwxx'},{id:14,text:'德国wwxx'}]");
            }

            if (tag == "childrendata")
            {
                string id = Request["id"] ?? string.Empty;

                if (id == "1")
                {
                    Response.Write(@"[{ dep: '中信', money1: '3000', money2: '3000', money3: '3000', money4: '3000',total:'12000' },
                    { dep: '中信', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'},
                    { dep: '中信', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'},
                    { dep: '中信', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'}]");
                }

                if (id == "2")
                {
                    Response.Write(@"[{ dep: '五矿', money1: '3000', money2: '3000', money3: '3000', money4: '3000',total:'12000' },
                    { dep: '五矿', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'},
                    { dep: '五矿', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'},
                    { dep: '五矿', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'}]");
                }

                if (id == "3")
                {
                    Response.Write(@"[{ dep: '万达', money1: '3000', money2: '3000', money3: '3000', money4: '3000',total:'12000',id:'5' },
                    { dep: '万达', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000',id:'6',hasChildren:'true'},
                    { dep: '万达', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000',id:'7',hasChildren:'true'},
                    { dep: '万达', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000',id:'8'}]");
                }

                if (id == "4")
                {
                    Response.Write(@"[{ dep: '高铁', money1: '3000', money2: '3000', money3: '3000', money4: '3000',total:'12000' },
                    { dep: '高铁', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'},
                    { dep: '高铁', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'},
                    { dep: '高铁', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'}]");
                }
                if (id == "6")
                {
                    Response.Write(@"[{ dep: '高铁', money1: '3000', money2: '3000', money3: '3000', money4: '3000',total:'12000' },
                    { dep: '高铁', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'},
                    { dep: '高铁', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'},
                    { dep: '高铁', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'}]");
                }
                if (id == "7")
                {
                    Response.Write(@"[{ dep: '万达1', money1: '3000', money2: '3000', money3: '3000', money4: '3000',total:'12000' },
                    { dep: '万达2', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'},
                    { dep: '万达3', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000',id:'10',hasChildren:'true'},
                    { dep: '万达4', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'}]");
                }
                if (id == "9")
                {
                    Response.Write(@"[{ dep: '高铁1', money1: '3000', money2: '3000', money3: '3000', money4: '3000',total:'12000' },
                    { dep: '高铁2', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'},
                    { dep: '高铁3', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'},
                    { dep: '高铁4', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'}]");
                }
                if (id == "10")
                {
                    Response.Write(@"[{ dep: '万达1-1', money1: '3000', money2: '3000', money3: '3000', money4: '3000',total:'12000' },
                    { dep: '万达2-1', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'},
                    { dep: '万达3-1', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'},
                    { dep: '万达4-1', money1: '3000', money2: '3000', money3: '3000', money4: '3000' ,total:'12000'}]");
                }
            }

            if (tag == "getList")
            {
                Response.Write(@"[
                { dep: '股销', money1: '3000', money2: '3000', money3: '3000', money4: '3000', total: '9999', id: 1 },
                { dep: '投行', money1: '3000', money2: '3000', money3: '3000', money4: '3000', total: '9999', id: 2 },
                { dep: '资管', money1: '3000', money2: '3000', money3: '3000', money4: '3000', total: '9999', id: 3 },
                { dep: '固收', money1: '3000', money2: '3000', money3: '3000', money4: '3000', total: '9999', id: 4 }]");
            }
        }
    }
}